<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        window.onload = function () {
            $(".dels").click(function () {
              if (!confirm("是否删除？")){
                  return
              }
            })
           $("#select").change(function () {
               $("#form").submit()
           })


        }
    </script>
</head>
<body>

 <a href="/Logout">退出</a>


<label>请选择文章分类</label>
<form id="form" method="post" action="/Article/ShowArticle">
    <select name="select" id="select" class="sel_opt">
        {{range .types}}
            <option selected="true" name="">{{.TypeName}}</option>
        {{end}}
    </select>
    <input type="submit" hidden="hidden">
</form>



<h1><a href="/Article/AddArticle">添加文章</a></h1>

<table>

    {{/*      {{range .articles}}*/}}
    {{/*      <tr>*/}}
    {{/*          <td>{{.Title}}</td>*/}}
    {{/*          <td><a href="#">查看详情</a></td>*/}}
    {{/*          <td>{{.Count}}</td>*/}}
    {{/*          <td>{{.Time}}</td>*/}}
    {{/*          <td><a href="#">删除</a></td>*/}}
    {{/*          <td><a href="#">编辑</a></td>*/}}
    {{/*          <td>财经新闻</td>*/}}
    {{/*      </tr>*/}}
    {{/*      {{end}}*/}}

    {{range  $index,$val:=.articles}}
        <tr>
            <td>{{$val.Title}}</td>
            <td><a href="/Article/ArticleContent?id={{$val.Id2}}">查看详情{{$val.Id2}}</a></td>
            <td>{{$val.Count}}次浏览</td>
            <td>{{$val.Time}}</td>
            <td><a href="/Article/DeleteArticle?id={{$val.Id2}}" class="dels">删除</a></td>
            <td><a href="/UpdateArticle?id={{$val.Id2}}">编辑</a></td>
            <td>{{$val.ArticleType.TypeName}}</td>
        </tr>


    {{end}}


</table>

 <ul>
     <li><a href="/Article/ShowArticle?pageIndex=1">首页</a></li>

{{if compare .FirstPage true}}
     <li>上一页</li>
     {{else}}
     <li><a href="/Article/ShowArticle?pageIndex={{.pageIndex | ShowPrePage}}">上一页</a></li>
     {{end}}

     <li><a href="/Article/ShowArticle?pageIndex={{.pageIndex | ShowNextPage}}">下一页</a></li>
     <li><a href="/Article/ShowArticle?pageIndex={{.pageCount}}">末页</a></li>
     <li>共{{.count}}条记录/共{{.pageCount}}页/当前{{.pageIndex}}页</li>
 </ul>

</body>
</html>